
OS := $(shell uname)
TOOL_DIR := tools

ifeq ($V, 1)
  Q =
  S =
else
  S ?= -s
  Q ?= @
endif

export V Q S

#
# if you want the ram-disk device, define this to be the
# size in blocks.
#

RAMDISK_START ?= 256

# Tool for Image building
BUILD = RAMDISK_START=$(RAMDISK_START) $(TOOL_DIR)/build.sh

ifeq ($(OS), Linux)
  AS      = as
  AFLAGS  = -g --32
  LD      = ld
  LDFLAGS = -m elf_i386
  CC      = gcc
  CFLAGS  = -g -m32 -fno-builtin -fno-stack-protector -fomit-frame-pointer -fstrength-reduce #-Wall

  CPP     = cpp -nostdinc
  AR      = ar
  STRIP   = strip
  OBJCOPY = objcopy
endif

ifeq ($(OS), Darwin)
  AS      = i386-elf-as
  AFLAGS  = -g --32
  LD      = i386-elf-ld
  LDFLAGS = -m elf_i386
  CC      = i386-elf-gcc
  CFLAGS  = -gdwarf-2 -g3 -m32 -fno-builtin -fno-stack-protector -fomit-frame-pointer -fstrength-reduce #-Wall

  CPP     = i386-elf-cpp -nostdinc
  AR      = i386-elf-ar
  STRIP   = i386-elf-strip
  OBJCOPY = i386-elf-objcopy
endif
